package com.example.week2.mvp.model;

import android.util.Log;
import android.widget.Toast;

import com.example.mylibrary.mvp.model.BaseModel;
import com.example.mylibrary.mvp.model.IModel;
import com.example.week2.mvp.contact.Contact;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.model.Response;

import java.util.HashMap;

public  class Model extends BaseModel implements Contact.Model{

    @Override
    public void register(String username, String pwd, String url) {
        HashMap<String, String> hashMap = new HashMap<>();
        hashMap.put("username",username);
        hashMap.put("user_password",pwd);
        OkGo.<String >post(url)
                .params(hashMap)
                .execute(new StringCallback() {
                    @Override
                    public void onSuccess(Response<String> response) {
                        String body = response.body();
                        Log.i("TAG", "onSuccess: ->"+body);

                    }
                });

    }
}
